<script type="text/javascript">
var setting = {
	view: {
		dblClickExpand: true,
		showLine: true,
		selectedMulti: true
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "fieldId",
			pIdKey: "fieldParantId",
			rootPId: ""
		},
		key:{
			name: "fieldName"
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");
			if (treeNode.isParent) {
				zTree.expandNode(treeNode);
				return false;
			} else {
				demoIframe.attr("src","base/_form.html?fieldId="+treeNode.fieldId);
				return true;
			}
		}
	}
};
$.post('/guidance_service/front/policies/field/search.do',{},function(obj){
	var data = obj.data;
	var list = new Array();
	var t = $("#treeDemo");
	t = $.fn.zTree.init(t, setting, data);
	demoIframe = $("#testIframe");
	var zTree = $.fn.zTree.getZTreeObj("tree");
});
var code;
function showCode(str) {
	if (!code) code = $("#code");
	code.empty();
	code.append("<li>"+str+"</li>");
}
</script>